package com.springboot.fram.core.digest;

import com.springboot.fram.core.digest.codec.Hex;

import java.util.Base64;

/**
 * 加密后转换
 *
 * @author madman
 */
public class Encrypt {

  private byte[] bytes;

  public Encrypt(byte[] bytes) {
    this.bytes = bytes;
  }

  public byte[] toBytes() {
    return bytes;
  }

  public String toHex() {
    return Hex.encode(bytes);
  }

  public String toBase64() {
    return Base64.getEncoder().encodeToString(bytes);
  }

  @Override
  public String toString() {
    return toHex();
  }

}
